#!/bin/bash
###SHELLPACK preamble libmicro-contextswitch-bench 1

###SHELLPACK parseargBegin
###SHELLPACK parseargInstall
###SHELLPACK parseargEnd
###SHELLPACK monitor_hooks

###SHELLPACK check_install_required libmicro-contextswitch-${VERSION}
###SHELLPACK init_complete

cd $SHELLPACK_SOURCES/libmicro-contextswitch-${VERSION}-installed || die Failed to cd to libmicro directory

COMMON="-E -C 0 -D 30000 -B 10000 -L -S -W"

while read A B C; do
	monitor_pre_hook $LOGDIR_RESULTS $A-$B
	if [ -f bin/$A ]; then
		eval bin/$A $COMMON -N "$B" $C 2>&1 > $LOGDIR_RESULTS/$B.log
	fi
	monitor_post_hook $LOGDIR_RESULTS $A-$B
done <<EOT
getcontext	getcontext
setcontext	setcontext
mutex	mutex_st
mutex	mutex_mt	-t
mutex	mutex_T2	-T 2
cascade_mutex	c_mutex_1
cascade_cond	c_cond_1
cascade_lockf	c_lockf_1
cascade_flock	c_flock
cascade_flock	c_flock_10 -P 10
cascade_flock	c_flock_200 -P 200
cascade_fcntl	c_fcntl_1
EOT

exit $SHELLPACK_SUCCESS
